package com.stox.shared.indicator.model.intf;

import java.util.List;

import com.stox.shared.core.model.Bar;
import com.stox.shared.indicator.model.ExponencialMovingAverage;
import com.stox.shared.indicator.model.RelativeStrengthIndex;
import com.stox.shared.indicator.model.SimpleMovingAverage;
import com.stox.shared.indicator.model.Stochastic;
import com.stox.shared.indicator.model.WeightedMovingAverage;
import com.stox.shared.indicator.model.enumeration.IndicatorDisplayType;
import com.stox.shared.indicator.model.enumeration.IndicatorPosition;

public interface Indicator<OUT, CONFIG> {
	
	Indicator<?,?>[] ALL = {
			SimpleMovingAverage.INSTANCE, 
			ExponencialMovingAverage.INSTANCE, 
			WeightedMovingAverage.INSTANCE,
			Stochastic.INSTANCE,
			RelativeStrengthIndex.INSTANCE};

	public String getCode();

	public IndicatorPosition getPosition(CONFIG config);

	public String getDisplayName();

	public IndicatorDisplayType getDisplayType(CONFIG config);

	/**
	 * The indicator may or may not support this method, if it needs more information from Bar other than simple double
	 * array
	 *
	 * @param configuration
	 * @param in
	 * @param index
	 * @return
	 * @throws UnsupportedOperationException
	 */
	public OUT getValue(CONFIG configuration, Double[] in, int index) throws UnsupportedOperationException;

	public OUT getValue(CONFIG configuration, List<Bar> bars, int index);

	/**
	 * The indicator may or may not support this method, if it needs more information from Bar other than simple double
	 * array
	 *
	 * @param configuration
	 * @param in
	 * @return
	 * @throws UnsupportedOperationException
	 */
	public OUT[] getValues(CONFIG configuration, Double[] in) throws UnsupportedOperationException;

	public OUT[] getValues(CONFIG configuration, List<Bar> bars);

	public CONFIG createDefaultConfiguration();

}
